package com.wceManage.beans;

import com.google.common.collect.Lists;
import org.apache.commons.beanutils.ConvertUtils;

import java.util.Date;
import java.util.List;

public class SysUser extends BaseBean {

	private static final long serialVersionUID = 1L;
	
	
	private Long userId;                                    // 用户编号
    private String username;                               // 用户名
    private String email;                                  // 邮箱
    private String phone;                                 // 手机号
    private String userNo;
    private String account;
    private String password;                               // 密码
    private String region;   //区域地址id
    private Integer orderRatio;
    private Long parent;
    private String address;
    private Integer status;                                    // 状态 0:禁用，1:正常
    private String salt;                                   // 盐值
    private Integer userType;
    private String source;                                // 来源
    private String userRole;
    private List<SysRole> roleList = Lists.newArrayList();  // 拥有角色列表
    
   

    private Integer byCount = 0;//购买数量
    private Double byPrice = 0.00;//购买金额
    private Integer teamCount = 0;//团队数量
    private Double teamTallMoney = 0.00;//团队总额
    private Double teamProfit = 0.00;//团队收益
    private String pName;//合伙人
    private String orderFstDate = "暂无的订单";//首单时间
    private Integer orderCount;//下单数
    private Double orderTallPrice;//下单总额
    private Long salesperson;//销售员id
    private String salespersonName;//销售员
    private String salespersonPhone;//销售员电话

    private Integer recommenderCount; //推荐的人的数量
    private Integer integral;//积分
    private String headimg;//头像
    private String openid;
    private Integer loginTimes;//登录次数
    private Date lastLoginTime;//最后登录时间
    
    private double cur_profit_price;
    
    private double profit_price;
    
    private int cur_number;
    
    private int number;
    
    
    

    public Integer getLoginTimes() {
		return loginTimes;
	}

	public void setLoginTimes(Integer loginTimes) {
		this.loginTimes = loginTimes;
	}

	public double getCur_profit_price() {
		return cur_profit_price;
	}

	public void setCur_profit_price(double cur_profit_price) {
		this.cur_profit_price = cur_profit_price;
	}

	public double getProfit_price() {
		return profit_price;
	}

	public void setProfit_price(double profit_price) {
		this.profit_price = profit_price;
	}

	public int getCur_number() {
		return cur_number;
	}

	public void setCur_number(int cur_number) {
		this.cur_number = cur_number;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public String getpName() {
        return pName;
    }

    public void setpName(String pName) {
        this.pName = pName;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public Integer getUserType() {
        return userType;
    }

    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getUserNo() {
        return userNo;
    }

    public void setUserNo(String userNo) {
        this.userNo = userNo;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public Integer getOrderRatio() {
        return orderRatio;
    }

    public void setOrderRatio(Integer orderRatio) {
        this.orderRatio = orderRatio;
    }

    public Long getParent() {
        return parent;
    }

    public void setParent(Long parent) {
        this.parent = parent;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getUserRole() {
        return userRole;
    }

    public List<SysRole> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<SysRole> roleList) {
        this.roleList = roleList;
    }

    public void setUserRole(String userRole) {
        this.userRole = userRole;
    }

    public Integer getByCount() {
        return byCount;
    }

    public void setByCount(Integer byCount) {
        this.byCount = byCount;
    }

    public Double getByPrice() {
        return byPrice;
    }

    public void setByPrice(Double byPrice) {
        this.byPrice = byPrice;
    }

    public Integer getTeamCount() {
        return teamCount;
    }

    public void setTeamCount(Integer teamCount) {
        this.teamCount = teamCount;
    }

    public Double getTeamTallMoney() {
        return teamTallMoney;
    }

    public void setTeamTallMoney(Double teamTallMoney) {
        this.teamTallMoney = teamTallMoney;
    }

    public Double getTeamProfit() {
        return teamProfit;
    }

    public void setTeamProfit(Double teamProfit) {
        this.teamProfit = teamProfit;
    }

    public String getOrderFstDate() {
        return orderFstDate;
    }

    public void setOrderFstDate(String orderFstDate) {
        this.orderFstDate = orderFstDate;
    }

    public Integer getOrderCount() {
        return orderCount;
    }

    public void setOrderCount(Integer orderCount) {
        this.orderCount = orderCount;
    }

    public Double getOrderTallPrice() {
        return orderTallPrice;
    }

    public void setOrderTallPrice(Double orderTallPrice) {
        this.orderTallPrice = orderTallPrice;
    }

    public String getSalespersonName() {
        return salespersonName;
    }

    public void setSalespersonName(String salespersonName) {
        this.salespersonName = salespersonName;
    }

    public Long getSalesperson() {
        return salesperson;
    }

    public void setSalesperson(Long salesperson) {
        this.salesperson = salesperson;
    }

    public String getSalespersonPhone() {
        return salespersonPhone;
    }

    public void setSalespersonPhone(String salespersonPhone) {
        this.salespersonPhone = salespersonPhone;
    }

    public List<Long> getRoleIdList() {
        List<Long> roleIdList = Lists.newArrayList();
        for (SysRole role : roleList) {
            roleIdList.add(role.getRoleId());
        }
        return roleIdList;
    }

    public void setRoleIdList(List<Long> roleIdList) {
        roleList = Lists.newArrayList();
        for (Long roleId : roleIdList) {
            SysRole role = new SysRole();
            role.setRoleId(roleId);
            roleList.add(role);
        }
    }

    public static Long[] stringToLong(String stringArray[]) {
        if (stringArray == null)
            return null;
        return (Long[]) ConvertUtils.convert(stringArray, Long.class);
    }

    public boolean isAdmin() {
        return isAdmin(this.userId);
    }

    public static boolean isAdmin(Long userId) {
        return userId != null && 1L == userId;
    }

    public Integer getRecommenderCount() {
        return recommenderCount;
    }

    public void setRecommenderCount(Integer recommenderCount) {
        this.recommenderCount = recommenderCount;
    }

    public Integer getIntegral() {
        return integral;
    }

    public void setIntegral(Integer integral) {
        this.integral = integral;
    }

	public String getHeadimg() {
		return headimg;
	}

	public void setHeadimg(String headimg) {
		this.headimg = headimg;
	}

	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}
    
    
}
